package com.blue.firecat.entity;

import com.blue.firecat.contants.Contants;
import com.blue.firecat.enums.TradeStatusEnum;
import com.blue.firecat.utils.date.DateUtil;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

/**
 * @author
 */
public class Trade implements Serializable {
    /**
     * 主键
     */
    private Long id;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 打手姓名
     */
    private String userName;

    /**
     * 客服id
     */
    private Long userId2;
    /**
     * 订单编号
     */
    private Long orderId;

    /**
     * 用户账号(审核通过才显示,结算完成需要把这两项清除)
     */
    private String gameUser;
    /**
     * 角色名
     */
    private String gameUserName;
    /**
     * 子帐号
     */
    private String gameUserChild;
    /**
     * 用户密码
     */
    private String gamePassword;

    /**
     * 游戏编号
     */
    private Integer gameId;

    /**
     * 游戏名称
     */
    private String gameName;

    /**
     * 手机
     */
    private Long phone;
    /**
     * 区服
     */
    private String serviceArea;

    /**
     * 阵营
     */
    private String camp;

    /**
     * 职业天赋
     */
    private String professionalTalent;

    /**
     * 装等
     */
    private String install;

    /**
     * 标题
     */
    private String title;

    /**
     * 描述
     */
    private String content;

    /**
     * 结算价(展示给打手的金额)
     */
    private BigDecimal settlePrice;

    /**
     * 备注
     */
    private String remark;

    /**
     * 图片(多张的话用,隔开,最多20张)
     */
    private String photo;

    /**
     * 图片(多张的话用,隔开,最多20张)
     */
    private List<String> photoList;

    /**
     * 申请时间
     */
    private Date createTime;

    private String createTimeString;

    /**
     * 操作更新时间
     */
    private Date updateTime;

    /**
     * 交易状态,0未知,1审核中(多个人申请一个,管理员和客服通过之后变成代练中,并且把其他人交易删除),2代练中,3待验收,4待结算,5已结算,6异常单,
     */
    private Integer status;

    private String statusString;
    /**
     * 操作人
     */
    private String operate;
    /**
     * 笔记
     */
    private String note;

    private static final long serialVersionUID = 1L;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Long getUserId2() {
        return userId2;
    }

    public void setUserId2(Long userId2) {
        this.userId2 = userId2;
    }

    public String getCreateTimeString() {
        return createTimeString;
    }

    public void setCreateTimeString(String createTimeString) {
        this.createTimeString = createTimeString;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getGameUser() {
        return gameUser;
    }

    public void setGameUser(String gameUser) {
        this.gameUser = gameUser;
    }

    public String getGameUserName() {
        return gameUserName;
    }

    public void setGameUserName(String gameUserName) {
        this.gameUserName = gameUserName;
    }

    public String getGamePassword() {
        return gamePassword;
    }

    public void setGamePassword(String gamePassword) {
        this.gamePassword = gamePassword;
    }

    public Integer getGameId() {
        return gameId;
    }

    public void setGameId(Integer gameId) {
        if (gameId == -1) {
            return;
        }
        this.gameId = gameId;
    }

    public String getGameName() {
        return gameName;
    }

    public void setGameName(String gameName) {
        this.gameName = gameName;
    }

    public String getServiceArea() {
        return serviceArea;
    }

    public void setServiceArea(String serviceArea) {
        this.serviceArea = serviceArea;
    }

    public String getCamp() {
        return camp;
    }

    public void setCamp(String camp) {
        this.camp = camp;
    }

    public String getProfessionalTalent() {
        return professionalTalent;
    }

    public void setProfessionalTalent(String professionalTalent) {
        this.professionalTalent = professionalTalent;
    }

    public String getInstall() {
        return install;
    }

    public void setInstall(String install) {
        this.install = install;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public BigDecimal getSettlePrice() {
        return settlePrice;
    }

    public void setSettlePrice(BigDecimal settlePrice) {
        this.settlePrice = settlePrice;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
        String[] p = photo.split(Contants.PIC_CUTTING);
        this.setPhotoList(new ArrayList<>());
        for (int i = 0; i < p.length; i++) {
            this.photoList.add(Contants.PIC_PATH.replaceFirst("/","") + p[i]);
        }
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
        this.setCreateTimeString(DateUtil.getInstance().getDateString(createTime));
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
        this.setStatusString(TradeStatusEnum.getValueByCode(status));
    }

    public String getGameUserChild() {
        return gameUserChild;
    }

    public void setGameUserChild(String gameUserChild) {
        this.gameUserChild = gameUserChild;
    }

    public String getStatusString() {
        return statusString;
    }

    public void setStatusString(String statusString) {
        this.statusString = statusString;
    }

    public String getOperate() {
        return operate;
    }

    public void setOperate(String operate) {
        this.operate = operate;
    }

    public List<String> getPhotoList() {
        return photoList;
    }

    public void setPhotoList(List<String> photoList) {
        this.photoList = photoList;
    }

    public Long getPhone() {
        return phone;
    }

    public void setPhone(Long phone) {
        this.phone = phone;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }
}